"use strict"

/**
 * 贵州省招投标网爬虫
 *  
 */

var Base = require("./base");
var gzzb_spider = new Base();
gzzb_spider.name = "贵州省招标信息网";
gzzb_spider.contentType = "text";
gzzb_spider.encode="GBK";

gzzb_spider.getPageUrl = function(pg) {
    return "http://guizhou.bidchance.com/tsp_520000_0_02_0_" +pg+ ".html";
};

gzzb_spider.getItems = function(data) {
    var items = [];
    var reg = new RegExp("<a href=\"(.*?)\"[\\s]class=\"big\"[\\s]title=\"(.*?)\"","ig");
    var regv;
    while(regv = reg.exec(data)){
    	var url = regv[1];
    	var title = regv[2];
    	var item = {};
        item.title = title;
        item.url = url;
        console.log(url);
        item.source = gzzb_spider.name;
        items.push(item);
    }
    return items;
};

exports = module.exports = gzzb_spider;